package com.sunfeng.netty.atguigu.buf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;


/**
 * @author sunfeng
 */
public class Demo01 {
    public static void main(String[] args) {
        ByteBuf buffer = Unpooled.buffer(10);

        for (int i = 0; i < 10; i++) {
            buffer.writeByte(i);
        }
       // System.out.println(buffer.capacity());
        for (int i = 0; i <buffer.capacity() ; i++) {
            System.out.println(buffer.readByte());
        }
        for (int i = 0; i < 10; i++) {
            buffer.writeByte(i);
        }
        System.out.println(buffer.writerIndex());

        System.out.println("===========");
        for (int i = 0; i <buffer.readerIndex()-1; i++) {
            System.out.println(buffer.readByte());
        }
    }
}
